#include <iostream>

#include "../Shared/Shared.hpp"
#include "../LibBuildNG/LibBuildNG.hpp"
#include "../CLang/CLang.hpp"

#include "TestBuildSelf.hpp"

void init()
{
  BuildNG::init_shared();
  BuildNG::init_libbuildng("../Win32Settings.xml");
  BuildNG::init_clang();
}

void shutdown()
{
  BuildNG::shutdown_clang();
  BuildNG::shutdown_libbuildng();
  BuildNG::shutdown_shared();
}

int main()
{
  try
  {
    init();

    BuildNG::TestBuildSelfWorkspace workspace("c:/test-workspace");
    workspace.test_build_shared();

    shutdown();
  }
  catch(const std::exception &err)
  {
    std::cerr << err.what() << std::endl;
    assert(!"An exception was thrown.");
  }
  catch(const Glib::Exception &err)
  {
    std::cerr << err.what().c_str() << std::endl;
    assert(!"An exception was thrown.");
  }
  catch(...)
  {
    assert(!"An exception of an unknown type was thrown.");
  }

  return 0;
}